- display_name = case poll.poll_option_name_format
- when 'i18n' then t(poll_option.name)
- when 'iso8601' then format_iso8601_for_humans(poll_option.name, @recipient.time_zone, @recipient.date_time_pref)
- else
  - plain_text(poll_option, :name)

- score = stance && stance.option_scores[poll_option.id.to_s]

- link = poll.active? && tracked_url(poll, poll_option_id: poll_option.id)
- link_attrs = {class: 'text-decoration-none'}
- option_color = poll_option.color.sub('#', '')

%table.rounded.mb-2.pa-1{style: "border: 1px solid #{poll_option.color}; width: 100%; max-width: 600px"}
  %tr.poll-mailer__poll-option
    %td{style: "width: 48px; height: 48px; text-align: center"}
      = optional_link(link, link_attrs) do
        - if poll.has_option_icon
          = image_tag("poll_mailer/vote-button-#{poll_option.icon}.png", width: 48, height: 48, alt: display_name, style: 'display: inline-block')
        - if ['poll'].include? poll.poll_type
          - if poll.is_single_choice?
            - if score && score > 0
              = image_tag("icons/radiobox-marked-#{option_color}.png", width: 24, height: 24, alt: display_name)
            - else
              = image_tag("icons/radiobox-blank-#{option_color}.png", width: 24, height: 24, alt: display_name)
          -else
            - if score && score > 0
              = image_tag("icons/checkbox-marked-#{option_color}.png", width: 24, height: 24, alt: display_name)
            - else
              = image_tag("icons/checkbox-blank-outline-#{option_color}.png", width: 24, height: 24, alt: display_name)
        - if ['score', 'dot_vote'].include? poll.poll_type
          - if score
            .text-h6= score
          - else
            = image_tag("icons/checkbox-blank-outline-#{option_color}.png", width: 24, height: 24, alt: display_name)
        - if ['ranked_choice'].include? poll.poll_type
          - if score
            .text-h6
              \#
              = poll.minimum_stance_choices - score + 1
          - else
            = image_tag("icons/checkbox-blank-outline-#{option_color}.png", width: 24, height: 24, alt: display_name)
        - if ['meeting'].include? poll.poll_type
          - if score
            - icon = {0 => 'disagree', 1 => 'abstain', 2 => 'agree'}[score]
            = image_tag("poll_mailer/vote-button-#{icon}.png", width: 48, height: 48, alt: display_name, style: 'display: inline-block')
          - else
            = image_tag("icons/checkbox-blank-outline-#{option_color}.png", width: 24, height: 24, alt: display_name)

    %td.pl-4
      = optional_link(link, link_attrs) do
        = display_name
      .text-caption
        = optional_link(link, link_attrs) do
          = plain_text(poll_option, :meaning)
